package com.mq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ytj
 * @date 2024/1/18
 */
@Component
public class Demo10Producer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(Integer id){
        Demo10Message message=new Demo10Message(id);
        rabbitTemplate.convertAndSend(Demo10Message.EXCHANGE_NAME,Demo10Message.ROUTING_KEY,message);
    }
}
